import axios from '@/utils/request'

// 获取所有频道列表
export const getAllChannels = () => {
  return axios({
    method: 'get',
    url: '/v1_0/channels'
  })
}

// 2.新增 用户频道
// userChannel -> {id,seq}
// id: 新关联频道的 id
// seq: 新关联频道的 序号
export const addUsrChannel = (userChannel) => {
  return axios({
    method: 'patch',
    url: '/v1_0/user/channels',
    data: {
      channels: [userChannel]
    }
  })
}

// 3.删除 用户频道
export const removeUsrChannel = (chanId) => {
  return axios({
    method: 'delete',
    url: `/v1_0/user/channels/${chanId}`
  })
}
